import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'
import Papers from '../views/Papers.vue'
import Setting from '../views/Setting.vue'
import Charts from '../views/Charts.vue'
import Tables from '../views/Table.vue'
import  Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import PopuScience from "../views/PopuScience";
import Monitor from "../views/Monitor";
import Stations from "@/views/Stations";

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Index',
    meta:{title:'管控',isleftarrow:true,rightIcon:'comment-circle-o',rightIconUser:'manager-o'},
    component: Index
  },
  {
    path: '/papers',
    name: 'Papers',
    meta:{title:'发现',isleftarrow:true,rightIcon:'comment-circle-o',rightIconUser:'manager-o'},
    component: Papers
  },
  {
    path: '/popuScience',
    name: 'PopuScience',
    component: PopuScience
  },
  {
    path: '/setting',
    name: 'Setting',
    meta:{title:'设置',isleftarrow:true,rightIcon:'comment-circle-o',rightIconUser:'manager-o'},
    component: Setting
  },
  {
    path: '/monitor',
    name: 'Monitor',
    component: Monitor
  },
  {
    path: '/charts',
    name: 'Charts',
    component: Charts
  },
  {
    path: '/tables',
    name: 'Tables',
    component: Tables
  },
  {
    path: '/login',
    name: 'Login',
    meta:{title:'登录'},
    component: Login
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },{
    path: '/stations',
    name: 'Stations',
    meta:{title:'台站工况'},
    component: Stations
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
